<template>
    <div>
      <br />

      <myheader/>

     
      <div class="container">

          <div class="item_column">
              <div class="left">   
                  
              </div>

              <div class="right"> 
                <br />
                <br />

                <h1>申请添加用户页面</h1>

                <div>
                    <van-field label="姓名" v-model="form.name" />
                    <van-field label="金额" v-model="form.money" />
                    <van-field label="机构名称" v-model="form.company" />

                    客服经理
                    <select v-model="form.manager_id">
                        <option :value="i.id" v-for="i in managelist" :key="i.id">{{i.name}}</option>
                    </select>
                    
                    <br />

                    注册来源
                    <select v-model="form.refromid">
                        <option :value="i.id" v-for="i in resourcelist" :key="i.id">{{i.name}}</option>
                    </select>

                    <br />

                    <van-button @click="add_customer">提交</van-button>
                </div>
               
                
              </div>

          </div>

      </div>
      
    </div>
</template>
  
<script>
import maxios from '../http/axios'
import myheader from './myheader.vue'

  export default {
    components: {
      'myheader':myheader,
      
    },
  
    data() {
      return {

        form:{},
        managelist:[],
        resourcelist:[]
      
      }
    },
    methods: {

        // 添加
        add_customer(){

            maxios('/customer_reg','post',this.form).then(res => {

                console.log(res)
            })
        },

        getmanagelist(){

            maxios('/managelist','get').then(res => {

                this.managelist = res.list
                this.getresourcelist()
            })
        },

        getresourcelist(){

            maxios('/get_regform','get').then(res => {

                this.resourcelist = res.list
            })

        }
      
    },
    mounted() {
        this.getmanagelist()
    }
  }
</script>
  
<style scoped>
@import url("../assets/style.css");

</style>